package com.ye.spring.proxy;

import org.springframework.stereotype.Component;

@Component
public class CalucatorStaticProxy implements Calculator{

    private Calculator calculator;

    public CalucatorStaticProxy(Calculator calculator) {
        this.calculator = calculator;
    }

    @Override
    public int add(int a, int b) {

        try {
            System.out.println("add 方法开始");
            int res = calculator.add(a, b);
            System.out.println("add 方法结束");
            return res;
        } catch (Exception e) {
            e.printStackTrace();
        } finally {

            System.out.println("add 方法执行完后执行");
        }
        return 0;
    }
}
